The present invention relates generally to computer software, and more particularly to serial port management.
Serial port communications are commonly used in a computing devices or computing systems. The physical connection to the serial port in a computing device or system is established by hardware such as direct cabling, modems, network interface devices, and other transmission devices. Although the physical connection is handled by hardware, the connection between the serial port and an application on the computing device is often handled by software.
Software application programs request a handle from the hardware in order to establish a connection. A hardware interface communicates with the hardware to request the handle. The hardware returns the handle to the hardware interface. The hardware interface passes the handle to the application program. Once the application program receives the handle, the application program manages control of the handle until the connection is terminated. The application program uses the handle to transfer and receive data.
The present invention is directed at providing a system and method for managing a serial port.
According to one aspect of the invention, the method for managing a serial port provides for a virtual serial port that establishes data communication connections between the physical serial port and an application program. The virtual serial port periodically suspends the physical connection between the data communication session so that command messages may be sent to and processed by the physical serial port.
According to another aspect of the invention, the method for managing a serial port includes a virtual serial port that periodically suspends a data communication session. The suspended data communication session is resumed within a time period determined by a heuristic calculation. While the data communication session is suspended, command messages are communicated to the serial port.
In yet another aspect of the invention a data communication session is suspended for a time period determined by various criteria including the communication channel bit rate, the serial port communication rate and a time quantum. Since the serial port communication rate is usually much greater than the channel bit rate, data communication sessions can be periodically suspended without losing the connection. By multiplexing between the data communication session and the command-mode, multiple functions can be accomplished at the same time.
According to another aspect of the invention, a virtual serial port manager provides for serial port management between application programs and a physical serial port in a portable electronic device. In one example, the portable electronic device is a wireless telephone device such as a cellular telephone. In another example, the portable electronic device is a GSM type of cellular telephone. In still another example, the portable electronic device is a personal information manager (PIM) type of device. Other electronic devices that operate in an AT-command environment may also utilize the present invention for serial port management.
Briefly described, the present invention provides for a virtual serial port (VSP) that is situated between a serial port in a mobile electronic device, applications that require a serial port connection handle, and other applications that require command-mode access to the serial port. Data-communication applications (e.g. web browsing, e-mail, etc.) connect to the serial port through the VSP. The VSP creates a virtual connection handle that is returned to the application. Command-mode requests (e.g., short messaging requests) are received by the hardware abstraction layer, translated into command-mode messages (e.g., AT commands) and placed in a queue. The VSP multiplexes the serial port between the currently-open data communication session (data-mode) and command-mode messages by periodically suspending the currently-open connection and processing one or more command-mode messages that are in the queue. A buffer continually stores incoming data while the data communication session is suspended. The VSP uses a heuristic calculation to determine the maximum time interval for which the data-communication session can be interrupted. The heuristic calculation takes a percentage of a time-quantum (e.g., 0.5 seconds) based upon the ratio of an average bit rate for air communication (e.g., 7000 bits/sec) and a bit rate for the serial port (e.g., 152,000 bits/sec). This helps to ensure that data-communications are not interrupted for a time interval long enough to result in lost data-packets. The parameter for the time quantum and other parameters may be statically or dynamically adjusted to account for a finite buffer size in the hardware.
According to one aspect of the present invention, a system of managing a port includes an interface that establishes a data-connection to the port. Another interface receives command-requests and stores command-messages in a buffer. The interface periodically suspends the established data-connection with the port if command-messages are located in the buffer. The interface sends as many command-messages from the buffer to the port as can be executed within a prescribed time interval and subsequently resumes the connection with the port. The prescribed time interval may be determined by a heuristic calculation.
According to another aspect of the present invention, a managed port is provided. The port manager generates a virtual handle when a data-connection is established. A heuristic calculation is used to determine when to switch between a data-mode and a command-mode. Data is routed between the port and the virtual handle when the operating mode is the data-mode. Command-messages are placed in a buffer. Several (possibly, none) command messages in the buffer are selected. The selected command messages from the buffer are sent to the port when the operating mode is the command-mode.
According to yet another aspect of the present invention, a computer readable medium having computer executable instructions for managing a port connection is provided. A call-mode is activated when a data-connection is established. The call-mode is deactivated when the data-connection is terminated. A heuristic calculation is used to determine a time interval. Data is routed between an application and the port during the time interval when the operating mode is the call-mode. The data-connection is suspended for the duration of the time interval when the operating mode is the call-mode. The command-mode is activated either when the call-mode is deactivated or when the data-connection is suspended. Command-messages that are awaiting processing when the operating mode is the command-mode are then processed. The suspended data connection is resumed after the completing the processing of command messages when the call-mode is active.
These and various other features and advantages, which characterize the present invention, will be apparent from a reading of the following detailed description in conjunction with the associated drawings.